<?php
function cpx_get_coupon_detail_2($cp_id, $kw_after_title = '')
{
    $description = get_post_field('post_content', $cp_id);
//    $coupon_code = get_post_meta($cp_id, 'coupon_code_metadata', true);
    $cp_exclusive = get_post_meta($cp_id, 'exclusive_metadata', true);
    $coupon_code = get_post_meta($cp_id, 'coupon_code_metadata', true);
    $store_id = get_post_meta($cp_id, 'store_coupon_metadata', true);
    $store_url = get_post_meta($store_id,'url_store_metadata',true);
    
    $store_name = get_the_title($store_id);
    if($kw_after_title)
        $store_name .= ' '.$kw_after_title;
    
    $outlink_cp = home_url().'/'.get_option('aff_out_link_prefix_cp').'/'.$cp_id;            
    $store_logo = get_post_meta($store_id,'logo_metadata',true);
    if(!$store_logo)
        $store_logo = cpx_get_store_thumb($store_url);       
?>
    <div id="<?php echo $cp_id;?>" class="row-fluid data-cp" data-store="<?php echo $store_id;?>" data-current_url="<?php echo cpx_current_url();?>">
                            <div class="span3 img-store">
                                    <a href="<?php echo get_permalink($store_id); ?>">
                                        <div class="imgx">
                                            <img src="<?php echo $store_logo; ?>" alt="<?php echo $store_name; ?>" title="<?php echo $store_name; ?>" />
                                        <span class="seemore">See more Coupons</span>
                                        </div>
                                    </a>
                            </div>
                            <div class="span9 hotcoupon-info-store">
                                    <h3>
                                       <a rel="nofollow" class="coupon_title" href="<?php echo $outlink_cp; ?>" target="<?php echo $store_id;?>"><?php echo get_post_field('post_title', $cp_id);?></a>
                                    </h3>
                                              <?php 
                                                if($cp_exclusive){?>
                                              <span class="type_icon exclusive_icon">
                                                  Exclusive
                                                  <span class="tooltip">You'll only find this coupon on Mark Coupons</span>
                                              </span>
                                               <?php }else{?>
                                                    <span class="type_icon sale_icon">Sale</span>
                                                <?php }?>
                                    <div class="row-fluid action-crux">
                                        <div class="action-mask span4">
                                                  <?php if($coupon_code == ''){ ?>
                                                      <span class="action-button get-deal">Get Deal</span>
                                                  <?php }else{?>
                                                      <span class="action-button get-code">
                                                          <div class="wrapper-code">
                                                              <p><?php echo $coupon_code;?></p>
                                                              <div class="wrapper-mask">Get Code</div>
                                                              <span class="mask"></span>
                                                          </div>
                                                      </span>
                                                  <?php }?>
                                        </div>
                                    </div>
                                    <div class="row-fluid info-descrip">
                                        <p class="description">
                                            
                                                <?php echo $description;?>
                                        
                                        </p>
                                    </div>
                                    <p class="merchantLink">
                                        <a href="<?php echo get_permalink($store_id); ?>" title="<?php echo $store_name;?>">More <?php echo $store_name; ?> &gt;&gt; </a>
                                    </p>
                                    <?php
                                        if(current_user_can('edit_post',$cp_id))
                                        {
                                            echo edit_post_link('Edit This Coupon','<p>[','] Author: ',$cp_id);
                                            $author_id = get_post_field('post_author', $cp_id);                                            
                                            echo the_author_meta('display_name', $author_id);
                                            echo ' | Rate: '.get_post_meta($cp_id, 'like_metadata',true).'/';
                                            echo (get_post_meta($cp_id,'dislike_metadata',true)?get_post_meta($cp_id,'dislike_metadata',true):'0');
                                            echo '</p>';   
                                        }
                                    ?>
                            </div>             
    </div>
    <hr/>
    <?php
}